{extend name="public/base" /}
{block name="head"}
{/block}
{block name="body"}
<div id="fuyun-app" class="fuyun-app">
  <div class="content-box">
    <div class="fuyun-title">
      <h5>权限组列表</h5>
      <a href="javascript:;" class="layui-btn fuyun-add-btn layui-btn-small layui-btn-normal add"><i class="fa fa-plus-square margin-right-5"></i>添加权限组</a>
    </div>
    <div class="main-box">
      <div class="layui-form">
        <table class="layui-table layui-form">
          <thead>
            <tr>
              <th width="5%">id</th>
              <th width="20%">权限组</th>
              <th width="10%">操作</th>
            </tr> 
          </thead>
          <tbody>
            {volist name="list['data']" id="vo"}
              <tr data-id="{$vo.id}">
                <td>{$vo.id}</td>
                <td>{$vo.group_name}</td>
                <td>
                  <div class="layui-btn-group">
                    <a class="layui-btn layui-btn-normal layui-btn-small edit" data-id="{$vo.id}" href="javascript:;">编辑</a>
                    <button class="layui-btn fuyun-btn-del layui-btn-small btn-del-id" data-url="{:Url('deleteAll')}" data-confirm="确定删除该分类吗？" data-successtip="删除成功！" data-id="<?=$vo['id']?>" ><i class="fa fa-close margin-right-5"></i>删除</button>
                  </div>
                </td>
              </tr>
            {/volist}
          </tbody>
        </table>
      </div>
      <div class="page-box">
        <fuyun-page 
          :pagesize="<?=$list['pageSize']?>" 
          :total = "<?=$list['totalRow']?>"
          :current-page = {$list['curPage']}
        ></fuyun-page>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
    layui.use([ 'layer','form'], function(){
        var layer = layui.layer;
        var form = layui.form();
        //全选
        form.on('checkbox(allChoose)', function(data){
            var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
            child.each(function(index, item){
                item.checked = data.elem.checked;
            });
            form.render('checkbox');
        });

        $(".add").click(function(){
          layer.open({
            type: 2,
            area:['1000px','600px'],
            content: "{:Url('create')}"
          });
        });

        $(".edit").click(function(){
            var id = $(this).attr("data-id");
            layer.open({
                type: 2,
                area:['1000px','600px'],
                content: "{:Url('update')}?id="+id
            });
        });
    });

    fuyun.components(['page'],{
      el:"#fuyun-app",
      data:{
        labelPosition: 'top',
      },
    });
</script>
{/block}
